
/*******************************************************
*  Team name: FTPMP
*  Class involve: EventCardController, BoardEngine
*  Version, Author, History of modification: 
*  Ver 1.0, Fred,
*  -add EventCardController, checkMT, drawCard
*******************************************************/

package control;
import java.awt.*;
import javax.swing.*;


import boundary.EventCardWindow;
import boundary.RoundWindow;

import entity.Card;
import entity.Event;


import boundary.EventCardWindow;
import boundary.RoundWindow;


public class EventCardController extends CardController 
{
	EventCardWindow eventCardWindow;
	BoardEngine be;
	
	public EventCardController(BoardEngine BE, RoundWindow RW) {
		super.boardEngine=BE;
		be = super.boardEngine;
		super.roundWindow=RW;
		super.board=super.boardEngine.getBoard();
	}
	
	@Override
	public void drawCard(Card card, int theplayer) 
	{
		Event event =(Event)card;
		this.eventCardWindow.setLabel(event.getOptions(), event.getEventHint(), event.getEventname(), theplayer, event.getEID());
	}
	
	public boolean checkMT(int pid, String MTType) 
	{
		return be.validUserMtType(pid, MTType);
	}
	
	
	public void answeredEvent(int ans, int PID, int EID) 
	{
		System.out.println("EventCardController-answeredEvent()-PID: "+PID+"EID: "+EID+"ans: "+ans);
		super.board.giveReward(PID, EID, ans, this.getClass().getName());
		super.board.clearCurrentBonus(PID);
		super.roundWindow.checkEndBtnState();
	}
	
	public void initEventCardWindow(EventCardWindow EW) 
	{
		this.eventCardWindow=EW;
	}

	public EventCardWindow getEventCardWindow() 
	{
		return this.eventCardWindow;
	}
}